//
//  TSCMyDBHelper.h
//  Tsc_IOS
//
//  Created by Rio on 15-5-5.
//  Copyright (c) 2015年 idream. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <sqlite3.h>
#import "TSCConstants.h"

@interface TSCMyDBHelper : NSObject

+ (void) initDB;
+ (sqlite3 *) openDB;
+ (void) closeDB:(sqlite3 *)db;

+ (NSString *) buildSqlSelectWithTableName:(NSString *)tableName columnArray:(NSArray *)columnArray whereDictionary:(NSDictionary *)whereDictionary;
+ (NSString *) buildSqlInsertWithTableName:(NSString *)tableName keyValueDictionary:(NSDictionary *)keyValueDictionary;
+ (NSString *) buildSqlUpdateWithTableName:(NSString *)tableName keyValueDictionary:(NSDictionary *)keyValueDictionary whereDictionary:(NSDictionary *)whereDictionary;
+ (NSString *) buildSqlDeleteWithTableName:(NSString *)tableName whereDictionary:(NSDictionary *)whereDictionary;

+ (NSArray *) selectWithSql:(NSString *)sql;
+ (NSArray *) selectWithTableName:(NSString *)tableName columnArray:(NSArray *)columnArray whereDictionary:(NSDictionary *)whereDictionary;
+ (void) insertWithTableName:(NSString *)tableName keyValueDictionary:(NSDictionary *)keyValueDictionary;
+ (void) updateWithTableName:(NSString *)tableName keyValueDictionary:(NSDictionary *)keyValueDictionary whereDictionary:(NSDictionary *)whereDictionary;
+ (void) deleteWithTableName:(NSString *)tableName whereDictionary:(NSDictionary *)whereDictionary;
@end
